package com.jp.knowledge.fragment;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.jp.knowledge.model.PositionKnowlegeMode;

/**
 * Created by 528787067@qq.com on 2017/7/28.
 */

public class AdjustSortTypeDetailFragment extends JobKnowledgeDataFragment {

	public static AdjustSortTypeDetailFragment newInstance(PositionKnowlegeMode data){
		AdjustSortTypeDetailFragment fragment = new AdjustSortTypeDetailFragment();
		Bundle bundle = new Bundle();
		bundle.putSerializable("data", data);
		fragment.setArguments(bundle);
		return fragment;
	}

	@Override
	public void onItemClick(int mainPosition, int subPosition) {
		Intent intent = new Intent();
		intent.putExtra("mainName", data.getList().get(mainPosition).getName());
		intent.putExtra("subName", data.getList().get(mainPosition).getList().get(subPosition).getName());
		intent.putExtra("navtype", data.getNavType());
		intent.putExtra("navtype2", data.getList().get(mainPosition).getList().get(subPosition).getId());
		Activity activity = getActivity();
		activity.setResult(Activity.RESULT_OK, intent);
		activity.onBackPressed();
	}
}
